<%@ page contentType="text/html;charset=UTF-8" pageEncoding="utf-8" trimDirectiveWhitespaces="true" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="my" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<fmt:message var="title" key="delivery.list.title"/>
<my:layout title="${title}">
 <jsp:attribute name="body">

        <p><fmt:message key="delivery.list.alldeliveries"/></p>

        <table class="basic">
            <tr>
                <th>id</th>
                <th><fmt:message key="delivery.sender"/></th>
                <th><fmt:message key="delivery.receiver"/></th>
                <th><fmt:message key="delivery.sendingDate"/></th>
                <th><fmt:message key="delivery.deliveryDate"/></th>
                <th><fmt:message key="delivery.price"/></th>
                <th><fmt:message key="delivery.employee"/></th>
                <th><fmt:message key="delivery.courier"/></th>
                <th><fmt:message key="delivery.paid"/></th>
                <th><fmt:message key="delivery.state"/></th>
                <th></th>
                 <th></th>
            </tr>
            <c:forEach items="${undeliveredDeliveries}" var="delivery">
                <tr>
                    <td>${delivery.id}</td>
                    <td><c:out value="${delivery.sender.getName()} ${delivery.sender.getSurname()} ${delivery.sender.getCity()}"/></td>
                    <td><c:out value="${delivery.receiver.getName()} ${delivery.receiver.getSurname()} ${delivery.receiver.getCity()}"/></td>
                    <td><c:out value="${delivery.sendingDate}"/></td>
                    <td><c:out value="${delivery.deliveryDate}"/></td>
                    <td><c:out value="${delivery.price}"/></td>
                    <td><c:out value="${delivery.employee}"/></td>
                    <td><c:out value="${delivery.courier}"/></td>
                    <td><c:out value="${delivery.paid}"/></td>
                    <td><c:out value="${delivery.state}"/></td>
                
                    <td>
                        <form method="post" action="${pageContext.request.contextPath}/delivery/delete/${delivery.id}">
                            <input type="submit" value="<fmt:message key='delivery.list.delete'/>">
                        </form>
                    </td>
                    <td>
                        <form method="get" action="${pageContext.request.contextPath}/delivery/update/${delivery.id}">
                            <input type="submit" value="<fmt:message key='delivery.list.edit'/>">
                        </form>
                    </td>

                </tr>
            </c:forEach>
        </table>

  
 
</jsp:attribute>
</my:layout>